/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package database;
import java.sql.*;

/**
 *
 * @author Donghui
 */

public class Select {

    final String url = "jdbc:mysql://192.168.222.101/isc?user=root&password=root&useUnicode=true";
    private Connection selectOpt;
    private Statement selectStatement;
    private ResultSet result;
    private String sql;
    private static Select local;

    public static Select getInstance(){
        if(local==null){
            local = new Select();
        }
        return local;
    }


    public ResultSet selectValue(String temp)
    {
        sql=temp;
        System.out.println(sql);
        try{
        Class.forName("com.mysql.jdbc.Driver");
        selectOpt = DriverManager.getConnection(url);
        selectOpt.setCatalog("isc");
        selectStatement=selectOpt.createStatement();
        result=selectStatement.executeQuery(sql);
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        return result;
    }
}
